<%@page import="javax.management.relation.Role"%>
<%@page import="servlets.AdminServlet"%>
<%@page import="java.io.FileOutputStream"%>
<%@page import="java.io.OutputStream"%>
<%@page import="java.io.InputStream"%>
<%@page import="java.io.PrintStream"%>
<%@page import="java.net.HttpURLConnection"%>
<%@page import="java.net.URL"%>
<%@page import="java.util.Enumeration"%>
<%@page import="java.util.Arrays"%>
<%@page import="java.awt.List"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.lang.reflect.Array"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1" import="java.util.ArrayList, db.*"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport"
	content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0" />

<!-- Icons for Web App<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" sizes="114x114" href="images/nav/index@2x.png">
<link rel="apple-touch-startup-image" href="images/splash/splash-screen.png" media="screen and (max-device-width: 320px)" />
<link rel="apple-touch-startup-image" media="(max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2)" href="images/splash/splash-screen@2x.png" />
-->
<title>Frontera Pesos Login</title>
<link href="styles/style.css" rel="stylesheet" type="text/css">
<link href="styles/type.css" rel="stylesheet" type="text/css">
<link href="styles/buttons.css" rel="stylesheet" type="text/css">
<link rel="stylesheet"
	media="only screen and (-webkit-min-device-pixel-ratio: 2)"
	type="text/css" href="styles/highdpi.css" />

<!-- Load the Latest JQuery Version and Latest Validation Plugin -->
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript"
	src="http://jzaefferer.github.com/jquery-validation/jquery.validate.js"></script>
<!-- utility js -->
<script type="text/javascript" src="scripts/fronteraWebUtility.js"></script>

</head>
<body>

	<% 
	
	String _errorMessage = "";
	String _userName = "";
	String _loginID = "";
	Cookie[] cookies = request.getCookies();
	
	%>

	<% 
	
	AdminServlet adSer = new AdminServlet();
	if(session.getAttribute("errorMessage") != null)
	  {
	    Object g =  session.getAttribute("errorMessage");
	    _errorMessage = g.toString();
	 }
	  else
	  {
	   _errorMessage = "";
	  }

  %>

	<div class="landing-page">
		<p class="center-text landing-logo shadow">
			<img class="replace-2x" width="200" src="assets/frontera-pesos-logo.png"
				alt="img"> <br /> Frontera Pesos Rewards Program!
		</p>

		<div class="login-box">
			<script>
function formSubmit(t)
{
	document.forms["pesos-entrance"]["fronteraFolder"].value = getFronteraPath();
	document.getElementById("adminRequestType").value = t;
	document.getElementById("pesos-entrance").submit();
}


function showErrorTxt()
{
	var em = '<%=_errorMessage%>';
	if(em !="")
			{
				alert(em);
				
			}
	
}
// Handles registration form capabilities
process = false;
function formRegister(t)
{
	//alert("test");
	if (process==false){	
	// Show Registration Form and hide login button when registration button is clicked.
	$('#register-button').click(function() {
    $('#registration-block').fadeIn('slow', function() {});
	$('#back').fadeIn('slow', function() {});
	$('#login-button').fadeOut('slow', function() {});
	
	//enable registration form submission
	process = true;
    });
	
}
	// else registration form is currently visible and enable submission
	else{
	formSubmit(t);
		}
}

function returnLogin()
{
    $('#registration-block').fadeOut('slow', function() {});
	$('#back').fadeOut('fast', function() {});
	$('#login-button').fadeIn('slow', function() {});	
	//disable registration form submission
	process = false;
}

  </script>
			<form name="sendUserToHomePage" id="sendUserToHomePage"
				action="Admin" method="post">
				<input type="hidden" name="sendUserHome" id="sendUserHomeId" />
			</form>
			<form name="pesos-entrance" id="pesos-entrance" action="Admin"
				method="post">
				<div id="errorTxt" class="errorMessageTxt"><%=_errorMessage %></div>
				<div id="loginForm">
					<input type="tel" name="phone" id="phone"
						placeholder="Mobile Number" class="text-input" /> <input type="password" name="password"
						id="password" placeholder="Password" class="text-input" /> <input type="hidden"
						name="adminRequestType" id="adminRequestType" value="admin"
						placeholder="adminRequestType" /> <input type="hidden"
						name="fronteraFolder" id="fronteraFolder" />
				</div>

				<!-- The registration-block div is Hidden from the user unless they click register -->
				<div id="registration-block">
					<input type="password" name="password" id="password"
						placeholder="Retype Password" class="text-input" />
					<input type="text" name="fullname" id="textfield"
						placeholder="Full Name" class="text-input" />
					<input type="email" name="email" id="username" placeholder="Email" class="text-input" />


					<p class="birthday-text">Enter your birthday for a special
						treat:</p>
					<input type="text" name="birthday" id="birthday" placeholder="mm/dd/yyyy">

				</div>
				<!-- End registration-block -->

				<div class="clear" style="height: 25px;"></div>
				<!-- <a class="checkbox login-check" href="#">remember me</a> -->
				<p>
					<span class="buttonBig" id="login-button"><a
						class="buttonBigYellow" onClick="formSubmit('login')"
						href="javascript:void(0)">Login</a></span><span id="back"> <a
						href="javascript:void(0)" onClick="returnLogin()" id="returnLogin">Return
							to login</a>
					</span> <span class="buttonBig" id="register-button"><a
						href="javascript:void(0)" onClick="formRegister('register')"
						class="buttonBigBlue">Register</a></span>
				</p>
			</form>
			<div class="clear"></div>
		</div>
		<div class="login-box-deco1"></div>
		<div class="login-box-deco2"></div>

		<!--	<p class="login-note shadow"><strong>*</strong>Forgot my Password</p> -->
		<div style="height: 25px;"></div>
	</div>
	


</body>
</html>